package com.dd.service.Impl;

import com.dd.entity.Role;
import com.dd.mapper.RoleMapper;
import com.dd.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
public class RoleServiceImpl implements RoleService {

    @Autowired
    RoleMapper roleMapper;
    @Override
    public List<Role> selectRoleAll() {
        System.out.println("查询全部角色信息");
        return null;
    }

    @Override
    @Transactional
    public void insertRole(String roleName) {
        System.out.println("添加新角色");

        Role role = new Role();
        role.setRoleName("学生会");
        roleMapper.insertRole(role);

        //测试抛出异常
//        int i = 10/0;
    }
}
